package com.seek.configuation;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;


/**
 * Description: oauth2 资源服务器认证
 * @author seek412
 * @version v1.0
 * @date 2018-09-22
 */
@Configuration
@EnableResourceServer
public class Oauth2ResourceConfig extends ResourceServerConfigurerAdapter {
    @Override
    public void configure(HttpSecurity http) throws Exception {
        //这里配置需要token验证的资源
        http
                .csrf().disable()
                .authorizeRequests()
                .antMatchers("/druid/**").permitAll()
                .antMatchers("/**").authenticated()
                .and().cors();//配置跨域处理
    }

}
